ser.loc[]
ser.loc[label]
Troubleshooting test!
Returns the element of the Series that corresponds to its row label.
- Note:
- Often
sercomes fromdf.get(column_name). - In DSC 10, we only use
locandilocon Series, and never on DataFrames. That's because we want to avoid working with row objects, which contain data of varying types. To extract something from a data frame, you should always usegetfirst to grab the column as a series, then uselocorilocto get the individual entry.
species_ser
- dog_001"dog"
- cat_001"cat"
- cat_002"cat"
- dog_002"dog"
- dog_003"dog"
- ham_001"hamster"
- ham_002"hamster"
- cat_003"cat"
species_ser.loc['dog_002']
'dog'
Problems or suggestions about this page? Fill out our feedback form.